package com.example.mapping.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 目标值映射类型枚举
 *
 * @author baoyoujia
 */
@AllArgsConstructor
@Getter
public enum DestValueTypeEnum {

    /**
     * 字符串
     */
    STRING(0,"字符串"),

    /**
     * 布尔
     */
    BOOL(1,"布尔"),

    /**
     * double
     */
    DOUBLE(2,"double"),

    /**
     * int
     */
    INT(3,"int"),

    /**
     * long
     */
    LONG(4,"long"),
    ;

    private final Integer type;

    private final String desc;

    public static DestValueTypeEnum valueOf(Integer type) {
        return Arrays.stream(DestValueTypeEnum.values()).filter(x -> Objects.equals(x.getType(), type)).findFirst().orElse(DestValueTypeEnum.STRING);
    }
}
